﻿Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Crystal.CLL

Public Module DataFactory
    Public Function CreateDataBase() As Microsoft.Practices.EnterpriseLibrary.Data.Database
        ' Dim db As Microsoft.Practices.EnterpriseLibrary.Data.Database
        'Try
        If Not CommonCLL.mstrConnectionstring.Equals(String.Empty) Then
            Dim connStr As String = CommonCLL.mstrConnectionstring
            Return New Sql.SqlDatabase(connStr)
            'Return New Sql.SqlDatabase(DecriptConnectionString)
        Else
            Return Nothing
            '  Return db
        End If
        'Catch ex As Exception
        '    Return Nothing
        'End Try

    End Function
    'Public Function DecriptConnectionString() As String
    '    Dim strDecryptedString As String = ""
    '    Dim connStr As String = ""
    '    'Try
    '    connStr = System.Configuration.ConfigurationManager.AppSettings("SqlServer").ToString()
    '    If connStr.ToLower.IndexOf("database") = -1 Then
    '        strDecryptedString = EncDec.Decrypt(connStr, "")
    '    Else
    '        strDecryptedString = connStr
    '    End If
    '    Return strDecryptedString
    '    'Catch ex As Exception
    '    '    Throw ex
    '    'Finally
    '    '    strDecryptedString = Nothing
    '    '    connStr = Nothing
    '    'End Try

    'End Function
End Module
